{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Pandas part 2\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "Folder_WhereIwas= os.getcwd()\n",
    "Folder_whereThoseTablesAre = r\"C:\\Users\\behzad\\Dropbox\\2 Teaching Activities\\0 EETBS 2018\\forked_repos\\Python4ScientificComputing_Fundamentals\\A 2018-2019\\Tables\"\n",
    "os.chdir(Folder_whereThoseTablesAre)\n",
    "window_DF = pd.read_csv(\"windows.csv\", sep=\";\", index_col = 0, header=0) \n",
    "os.chdir(Folder_WhereIwas)\n",
    "\n",
    "# Second way of handling this location problem\n",
    "name_file_windows = \"windows.csv\"\n",
    "path_file_windows = os.path.join(Folder_whereThoseTablesAre,name_file_windows) \n",
    "window_DF = pd.read_csv(path_file_windows, sep=\";\", index_col = 0, header=0) \n",
    "window_DF.head(4)\n",
    "window_DF.tail(1)\n",
    "window_DF.index\n",
    "window_DF.columns\n",
    "window_DF.loc[\"west\",'Window_ID']\n",
    "window_DF.loc[:,'width']\n",
    "window_DF['width']\n",
    "window_DF['Area']=window_DF['width']*window_DF['Height']\n",
    "window_DF.to_csv(path_file_windows,sep=\";\") # I am adding this sep=\";\" just because if not I will have to rearrange it in excel and I am lazy !\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "name_file_modifiedWindows=\"window_modified.csv\"\n",
    "path_file_modifiedwindows = os.path.join(Folder_whereThoseTablesAre,name_file_modifiedWindows) \n",
    "window_DF.to_csv(path_file_modifiedwindows,sep=\";\") # I am adding this sep=\";\" just because if not I will have to rearrange it in excel and I am lazy !\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "C_Value = location_deltaT_cooling - 0.46*location_DR_cooling\n",
    "window_DF[\"C_value\"]= C_Value\n",
    "\n",
    "\n",
    "name_file_IAC_Cl=\"IAC_cl.csv\"\n",
    "path_file_IAC_Cl = os.path.join(Folder_whereThoseTablesAre,name_file_IAC_Cl) \n",
    "IAC_cl_DF = pd.read_csv(path_file_IAC_Cl, sep=\";\", index_col = 1, header=0) \n",
    "IAC_cl_DF.head(3)\n",
    "IAC_cl_DF.loc[\"1c\",\"BlindsDark\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def IAC_CL_finder(windowID,intShadingID):  \n",
    "    name_file_IAC_Cl=\"IAC_cl.csv\"\n",
    "    path_file_IAC_Cl = os.path.join(Folder_whereThoseTablesAre,name_file_IAC_Cl) \n",
    "    IAC_cl_DF = pd.read_csv(path_file_IAC_Cl, sep=\";\", index_col = 1, header=0) \n",
    "    IAC_cl_value = IAC_cl_DF.loc[windowID,intShadingID]\n",
    "    return IAC_cl_value\n",
    "\n",
    "IAC_CL_finder(\"1c\",\"BlindsDark\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.15"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
